define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		function get_data_hotcat_list(result){
			if(HTTP_ISLOGIC){
				result = '{"success":true,"msg":"","result":{"goods":[{"goods_id":"goods_id_001","name":"产品111","introduce":"好产品","price":10,"mktprice":11,"preprice":9,"image":"img/upload/pro-img01.jpg","storenumber":1000,"salenumber":2000},{"goods_id":"goods_id_002","name":"产品222","introduce":"非常好产品","price":10,"mktprice":11,"preprice":9,"image":"img/upload/pro-img01.jpg","storenumber":2000,"salenumber":3000}]},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			}else
			return result;
		}
		//返回信息
		return {
			//获取首页数据
			get_product_info: function(callback) {
				//post请求
				Http.post('home', {}, function(result) {
					//函数回调
					if(callback)
						callback(result);
				});

			},
			hotcat_list:function(key,store_cat,callback){
				Http.post({
					method:'shop.goods.getlist',
					key:key,
					pagelimit:8,
					nPage:1,
					show_count:5,
					picSize:'CS',
					store_cat:store_cat,
					is_new:false
				},function(result){
					if(callback)
					callback(get_data_hotcat_list(result).result);
				},function(e){
					
				},function(){
					
				})
			}
		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Hotcat", factory);
});